import { createRouter, createWebHashHistory } from "vue-router";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/LogIn",
      name: "LogIn",
      component: () => import("@/views/users/LogIn.vue"),
    },
    {
      path: "/Register",
      name: "Register",
      component: () => import("@/views/users/Register.vue"),
    },
    // {
    //   path: "/Home",
    //   name: "Home",
    //   component: () => import("@/views/home/Home.vue"),
    // },
    {
      path: "/Main",
      component: () => import("@/views/main/Main.vue"),
      children: [{
        path: "/Home",
        name: "Home",
        component: () => import("@/views/home/Home.vue"),
        meta:{
          title:["首页"]
        }
      },
      {
        path: "/UserManage",
        name: "UserManage",
        component: () => import("@/views/systemManagement/UserManage.vue"),
        meta:{
          title:["系统管理","用户管理"]
        }
      },{
        path: "/MenuManage",
        name: "MenuManage",
        component: () => import("@/views/systemManagement/MenuManage.vue"),
        meta:{
          title:["系统管理","菜单管理"]
        }
        

      }]
    },
    {
      path: "/",
      redirect: "/LogIn",
    },
  ],
});
router.beforeEach((to, from, next) => {
  NProgress.start() // 进度条开始
  next()
})

router.afterEach(() => {
  NProgress.done() // 进度条结束
})

export default router;
